package net.sureon.web.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sureon.app.UserSession;
import net.sureon.biz.ApplicationMgr;
import net.sureon.biz.DailyTimingMgr;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 * 
 * @author Administrator
 * 
 */
public class DeleteApplication implements Controller {

	private ApplicationMgr applicationMgr;

	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		long companyID = ((net.sureon.app.UserSession) request.getSession()
				.getAttribute(UserSession.HTTP_SESSION_KEY)).getCompanyID();
		
		long applicationID = Long.parseLong(request.getParameter("applicationID"));

		applicationMgr.deleteApplication(companyID, applicationID);
		
		response.sendRedirect(request.getContextPath()
				+ "/user/myApplication.do");
		return null;
	}

	public ApplicationMgr getApplicationMgr() {
		return applicationMgr;
	}

	public void setApplicationMgr(ApplicationMgr applicationMgr) {
		this.applicationMgr = applicationMgr;
	}

}
